package com.gu.myviewmodel.ui

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.gu.myviewmodel.R
import com.gu.myviewmodel.databinding.ActivityMainBinding
import com.gu.myviewmodel.ui.homepage.ui.MainFragment
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        var fragment = supportFragmentManager.findFragmentByTag(MainFragment.TAG)
        if (fragment == null) {
            fragment = MainFragment()
            supportFragmentManager.beginTransaction().replace(R.id.container, fragment, MainFragment.TAG).commit()
        }
    }
}